<?php
/*******************************************************************************
 *
 *  Name: viewResolvedIncidnets
 *
 *  Date: 05/03/2012
 *  
 *  Description: Shows resolved incidents to the manager and allows them to 
 *               click on one and then redirects the manager to 
 *               viewResolvedReports
 *  
 *  Author: David Jarman
 *  
 *  Todo:
 *     NONE
 *
 *  Modification History:  
 * 
 *   Date         Name
 *  ----------   --------------
 *  2012-04-27   DAVID JARMAN
 *  2012-04-26   DAVID JARMAN
 *  2012-05-03   DAVID JARMAN
 * 
 *****************************************************************************/
?>
<html>
    <head>
    </head>

    <body
        <div>
            <div style="text-align:center">
                <h3>Resolved Incidents</h3>
            </div>
            <table border="2px" style="width:100%">
                <tr>
                    <td>IncidentID</td>
                    <td>Name</td>
                    <td>Assigned Team</td>
                    <td>Cause</td>
                    <td>Finished</td>
                    <td>Related Reports</td>
                </tr>
                <?php
                    foreach($entries as $entry)
                    {
                        $cause = "";
                       switch($entry['CauseCode']) {
                          case 1:
                             $cause = "Unknown";
                             break;
                          case 1: 
                             $cause = 'Weather';
                             break;
                          case 2: 
                             $cause = 'Vandalism';
                             break;
                          case 3:
                             $cause = 'Corrosion';
                             break;
                          case 4:
                             $cause = 'Accident';
                             break;
                          case 5:
                             $cause = 'Other';
                             break;
                          default:
                            $cause = 'Unknown';
                            break;
                       }
                        echo "<tr>";
                        echo "<td>".$entry['IncidentID']."</td>";
                        echo "<td>".$entry['Name']."</td>";
                        echo "<td>".$entry['AssignedTeam']."</td>";
                        echo "<td>".$cause."</td>";
                        echo "<td>".$entry['WorkFinished']."</td>";
                        echo "<td style='text-align:center'>".anchor("/manager/viewResolvedReports/".$entry['IncidentID']."/", "View")."</td>";
                        echo "</tr>";
                    }
                ?>
            </table>
        </div>
    </body>

</html>
